home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / mcu332 / c32src.arc / CHIPSEL.LST next >
File List  |  1991-03-01  |  47KB  |  795 lines

  1. Motorola Family Assembler BETA TEST VERSION  (2.1.5 ) Fri Mar 01 13:32:16 1991
  2.  
  3. M68300 BUSINESS CARD COMPUTER CHIP SELECT INIT
  4.  
  5. abs. rel.   LC   obj. code   source line
  6. ---- ----   ---- ---------   -----------
  7.    1    1                   |        TTL       M68300 BUSINESS CARD COMPUTER CHIP SELECT INIT
  8.    2    2                   |        OPT       P=68332             SETUP FOR 68332 CODE
  9.    3    3                   |        OPT       BRS                 SHORT BRANCHES PREFERED
  10.    4    4                   |
  11.    5    5                   |******************************************************************************
  12.    6    6                   |*** EXPORTED PORTION OF THE MODULE HEADER                                  ***
  13.    7    7                   |*V****************************************************************************
  14.    8    8                   |******************************************************************************
  15.    9    9                   |***                                                                        ***
  16.   10   10                   |*** MODULE :       CHIP SELECT INITIALIZATION                              ***
  17.   11   11                   |***                                                                        ***
  18.   12   12                   |*** ENVIRONMENT :  68300 Business Card Computer (BCC) Rev. A, B            ***
  19.   13   13                   |***                For M68300PFB Platform Board, Rev. A, B, C              ***
  20.   14   14                   |***                                                                        ***
  21.   15   15                   |***                NOTE:  BCC Rev. A + PFB Rev. A = Old System             ***
  22.   16   16                   |***                       BCC Rev. B + PFB Rev. B = New System             ***
  23.   17   17                   |***                                                                        ***
  24.   18   18                   |***                       PFB Rev. C is jumper selectable to be function-  ***
  25.   19   19                   |***                       ally equivalent to Rev. A or to Rev. B.          ***
  26.   20   20                   |***                                                                        ***
  27.   21   21                   |***                 ---- DO NOT MIX REV. A's WITH REV. B's! ----           ***
  28.   22   22                   |***                 ---- NO STACK USAGE (SUBR'S) ALLOWED!   ----           ***
  29.   23   23                   |***                                                                        ***
  30.   24   24                   |*** LANGUAGE :     68332 ASSEMBLY LANGUAGE                                 ***
  31.   25   25                   |***                                                                        ***
  32.   26   26                   |*** SUMMARY OF CONTENTS :                                                  ***
  33.   27   27                   |***     Determines BCC type (A or B) and initializes the appropriate chip  ***
  34.   28   28                   |***     selects using the corresponding values from the parameter area.    ***
  35.   29   29                   |***                                                                        ***
  36.   30   30                   |*** LINK REQUIREMENTS :                                                    ***
  37.   31   31                   |***   NOTES:                                                               ***
  38.   32   32                   |***     1.  Source equivalent copy of CPU32Bug parameter area for Motorola ***
  39.   33   33                   |***         FREEWARE Bulletin Board System (BBS) to produce object         ***
  40.   34   34                   |***         equivalent code.  See REVISION HISTORY below for version nbr.  ***
  41.   35   35                   |***     2.  This source code can be freely used at no cost/obligation,     ***
  42.   36   36                   |***         i.e. it is PUBLIC DOMAIN software.  Please report any errors/  ***
  43.   37   37                   |***         additions to the SYSOP of the Motorola FREEWARE BBS.           ***
  44.   38   38                   |***     3.  Parameters which reference linker symbols (XREF/XDEF) will     ***
  45.   39   39                   |***         not be defined until link time, so the obj. code listed here   ***
  46.   40   40                   |***         will not match the actual EPROM code.                          ***
  47.   41   41                   |***                                                                        ***
  48.   42   42                   |******************************************************************************
  49.   43   43                   |*^****************************************************************************
  50.   44   44                   |*
  51.   45   45                   |         PAGE
  52.   46   46                   |*
  53.   47   47                   |******************************************************************************
  54.   48   48                   |*** INTERNAL PORTION OF THE MODULE HEADER                                  ***
  55.   49   49                   |******************************************************************************
  56.   50   50                   |***                                                                        ***
  57.   51   51                   |***   REVISION HISTORY (add changes to the top):                           ***
  58.   52   52                   |***                                                                        ***
  59.   53   53                   |***      DATE         AUTHOR               CHANGES                         ***
  60.   54   54                   |***   ----------  ---------------  -------------------------------------   ***
  61.   55   55                   |***    03/01/91   Peter S. Gilmour Compatible with CPU32Bug version 1.00.  ***
  62.   56   56                   |***    05/02/90   Peter S. Gilmour Compatible with 332Bug version 1.02.    ***
  63.   57   57                   |***    01/17/90   Peter S. Gilmour Initial version port to MS_DOS based    ***
  64.   58   58                   |***                                M68MASM from original source code.      ***
  65.   59   59                   |***                                Compatible with 332Bug version 1.01.    ***
  66.   60   60                   |******************************************************************************
  67.   61   61                   |*** XDEFS :                                                                ***
  68.   62   62                   |        XDEF    INIT_CS
  69.   63   63                   |***                                                                        ***
  70.   64   64                   |*** XREFS :                                                                ***
  71.   65   65                   |        XREF    PWR_TBL2
  72.   66   66                   |        XREF    .CSBAR0,.CSBAR1,.CSBAR2,.CSBARBT
  73.   67   67                   |        XREF    CSBAR0$
  74.   68   68                   |        XREF    MCR_OR,MCR_AND
  75.   69   69                   |        XREF    SYPCR_OR,SYPCR_AND
  76.   70   70                   |***                                                                        ***
  77.   71   71                   |***   Local macros:                                                        ***
  78.   72   72                   |***                                                                        ***
  79.   73   73                   |SYSTEM   MACRO                         ! SETUP MONITOR SPACE
  80.   74   74                   |SECTD    SET       1                   ! DEFINE DATA SECTION
  81.   75   75                   |SECTP    SET       14                  ! DEFINE PROGRAM SECTION
  82.   76   76                   |         SECTION   SECTP               ! PUT USER INTO PROG. SECTION
  83.   77   77                   |         ENDM                          !
  84.   78   78                   |*
  85.   79   79                   |* Time delay macro
  86.   80   80                   |*   - allows bus capacitance to dissipate
  87.   81   81                   |*   - at least 3 words must be fetched to guarantee dissipation
  88.   82   82                   |*
  89.   83   83                   |T_DELAY MACRO
  90.   84   84                   |        NOP
  91.   85   85                   |        NOP
  92.   86   86                   |        NOP
  93.   87   87                   |        ENDM
  94.   88   88                   |
  95.   89   89                   |***
  96.   90   90                   |***   Local equates:
  97.   91   91                   |***
  98.   92   92        0000 0000  |OLD_BCC  EQU       0                   Code ID for old BCC
  99.   93   93        0000 0001  |NEW_BCC  EQU       1                   Code ID for new BCC
  100.   94   94                   |
  101.   95   95                   |*
  102.   96   96                   |*  For M68300 BCC and PFB.
  103.   97   97                   |*
  104.   98   98                   |*  NOTE: Unused upper address lines are specified as 1's so ABSOLUTE SHORT
  105.   99   99                   |*        addressing (sign extension) can be used.
  106.  100  100                   |*
  107.  101  101        0000 2700  |SR_VAL    EQU      $2700               Status register initial value.
  108.  102  102                   |
  109.  103  103        0000 0000  |RAM_BASE  EQU      $0                  BCC RAM base address
  110.  104  104        0001 0000  |RAM_SIZE  EQU      $10000              BCC RAM size (bytes)
  111.  105  105        000E 0000  |ROM1_BASE EQU      $E0000              BCC EPROM base address
  112.  106  106        0002 0000  |ROM1_SIZE EQU      $20000              BCC EPROM size (bytes)
  113.  107  107        0004 0000  |IRAM_BASE EQU      $40000
  114.  108  108        FFFF E800  |FPCP_BASE EQU      $FFFFE800           PFB MC68881/MC6882 base address
  115.  109  109                   |*                                      .  (Floating Point Co-Processor)
  116.  110  110        0000 8000  |FCRYSTVAL EQU      32768               Crystal frequency (in Hz)
  117.  111  111        FFFF F000  |HI_BASE   EQU      $FFFFF000           CPU32 module (registers) base high addr
  118.  112  112                   |*                                      .  This is the default used at power-up!
  119.  113  113        007F F000  |LO_BASE   EQU      $007FF000           CPU32 module (registers) base low  addr
  120.  114  114        0000 0A00  |SIM       EQU      $A00                CPU32 System Integration Module base addr
  121.  115  115        0000 0B00  |RAMCR     EQU      $B00                CPU32 RAM Control Module base offset
  122.  116  116        0000 0C00  |QSM       EQU      $C00                CPU32 Queued Serial Module base offset
  123.  117  117        FFFF F800  |AUTO_BASE EQU      $FFFFF800           Autovector base address
  124.  118  118                   |
  125.  119  119                   |* Define bits for Power Up Status (PWRSTATUS) flag:
  126.  120  120        0000 001F  |EXTAL_BIT  EQU     31                  External Clock flag bit:    0= off (VCO)
  127.  121  121        0000 001E  |CHKSUM_BIT EQU     30                  Checksum not pgm'd yet bit: 0= pgm'd
  128.  122  122                   |
  129.  123  123        0000 0000  |LOCALRAM  EQU      RAM_BASE            base of local RAM
  130.  124  124        0000 4000  |SYSRAMSZ  EQU      $00004000           size of local RAM (for system use)
  131.  125  125        0001 0000  |LCLRAMMX  EQU      RAM_SIZE            max size of local RAM (for M68332 BCC)
  132.  126  126        0000 4000  |USRRAM    EQU      LOCALRAM+SYSRAMSZ   base of user RAM
  133.  127  127        0000 C000  |USRRAMSZ  EQU      LCLRAMMX-SYSRAMSZ   size of user RAM
  134.  128  128        0000 0000  |RAMSTART  EQU      LOCALRAM            alias for base of local RAM
  135.  129  129                   |
  136.  130  130        000E 0000  |LOCALROM  EQU      ROM1_BASE           base of local ROM (use PC rel refs!)
  137.  131  131        0001 0000  |LCLROMSZ  EQU      $00010000           size of local ROM used by 332Bug
  138.  132  132        0000 00FF  |ROMUNPGM  EQU      $FF                 unprogrammed state of a byte of EPROM
  139.  133  133        0000 00FF  |FILL.1    EQU      ROMUNPGM            fill value for 1 byte = BYTE
  140.  134  134        0000 FFFF  |FILL.2    EQU      FILL.1<<8+FILL.1    fill value for 2 bytes= WORD
  141.  135  135        FFFF FFFF  |FILL.4    EQU      FILL.2<<16+FILL.2   fill value for 4 bytes= LONG WORD
  142.  136  136                   |
  143.  137  137        0001 0000  |RAM2_BASE EQU      LOCALRAM+LCLRAMMX   Next RAM base address
  144.  138  138        0010 0000  |ROM2_BASE EQU      ROM1_BASE+ROM1_SIZE Next ROM base address
  145.  139  139                   |
  146.  140  140        0000 0400  |VECTSIZ  EQU       $400                Vector table size
  147.  141  141        0000 1000  |USERLEN  EQU       $1000               user space reserved
  148.  142  142        0000 4000  |MEMINC   EQU       $4000               memory increment for 130's or EVM's
  149.  143  143        0000 2BFC  |STKLEN   EQU       MEMINC-USERLEN-VECTSIZ-4 size of bug/diag stack + static vars
  150.  144  144                   |
  151.  145  145                   |*
  152.  146  146                   |* Interrupt levels & vectors
  153.  147  147                   |*
  154.  148  148        0000 0007  |ABORTLVL EQU       7                   abort level
  155.  149  149        0000 001F  |ABORTVEC EQU       31                  abort vector
  156.  150  150        0000 0007  |ACFAILVL EQU       7                   AC-Fail level
  157.  151  151        0000 0041  |ACFAILVC EQU       65                  AC-Fail vector
  158.  152  152        0000 0006  |TIMERLVL EQU       6                   timer level: M68332 periodic int. timer
  159.  153  153        0000 0042  |TIMERVEC EQU       66                  timer vector
  160.  154  154                   |
  161.  155  155                   |*
  162.  156  156                   |*  Setup Base Addresses:
  163.  157  157                   |*    1. A31-A24 must= 0  (MC68332 only uses A0-A23; rest are unused!)
  164.  158  158                   |*    2. A10-A0  must= 0  (for Base Address Register usage).
  165.  159  159                   |*
  166.  160  160        00FF F800  |ADDRMASK EQU       $00FFF800           Address mask (24-bits, A10-A0= 0)
  167.  161  161        0000 0000  |RAM      EQU       RAM_BASE&ADDRMASK   Setup Base Addresses
  168.  162  162        000E 0000  |ROM      EQU       ROM1_BASE&ADDRMASK  Setup Base Addresses
  169.  163  163        0001 0000  |RAM2     EQU       RAM2_BASE&ADDRMASK  Setup Base Addresses
  170.  164  164        0010 0000  |ROM2     EQU       ROM2_BASE&ADDRMASK  Setup Base Addresses
  171.  165  165        00FF E800  |FPCP     EQU       FPCP_BASE&ADDRMASK  Setup Base Addresses
  172.  166  166        0004 0000  |IRAM     EQU       IRAM_BASE&ADDRMASK  Setup Base Addresses
  173.  167  167        00FF F800  |AVEC_7   EQU       AUTO_BASE&ADDRMASK  Setup Base Addresses
  174.  168  168                   |
  175.  169  169        0000 0000  |CSBAR_XX EQU       $0000               Reset (unused) value for CSBARn
  176.  170  170        0000 0000  |CSOR_XX  EQU       $0000               Reset (unused) value for CSORn
  177.  171  171                   |
  178.  172  172        0000 0A00  |MCR      EQU       SIM+$00             Module Control Register
  179.  173  173        0000 0006  |MM_BIT   EQU       6                   .  MM bit number                 in MCR
  180.  174  174        0000 0A04  |SYNCR    EQU       SIM+$04             Clock Synthesizer Control Register
  181.  175  175        0000 4000  |VCO_X    EQU       $4000               VCO Frequency Control Bit X value
  182.  176  176        0000 0A20  |SYPCR    EQU       SIM+$20             System Protection Control Register
  183.  177  177        0000 0007  |SWE_BIT  EQU       7                   .  SWE bit number                in SYPCR
  184.  178  178        0000 0006  |SWP_BIT  EQU       6                   .  SWP bit number                in SYPCR
  185.  179  179        0000 0080  |SWE      EQU       1<<7                .  Software Watchdog Enable      in SYPCR
  186.  180  180        0000 0040  |SWP      EQU       1<<6                .  Software Watchdog Prescale    in SYPCR
  187.  181  181        0000 0008  |HME      EQU       1<<3                .  Halt Monitor Enable           in SYPCR
  188.  182  182        0000 0004  |BME      EQU       1<<2                .  Bus  Monitor Enable           in SYPCR
  189.  183  183        0000 0003  |BMT8     EQU       %11<<0              .  Bus  Monitor Timing  8 cycles in SYPCR
  190.  184  184        0000 0002  |BMT16    EQU       %10<<0              .  Bus  Monitor Timing 16 cycles in SYPCR
  191.  185  185        0000 0001  |BMT32    EQU       %01<<0              .  Bus  Monitor Timing 32 cycles in SYPCR
  192.  186  186        0000 0000  |BMT64    EQU       %00<<0              .  Bus  Monitor Timing 64 cycles in SYPCR
  193.  187  187        0000 0A27  |SWSR     EQU       SIM+$27             Software Service Reg (WATCHDOG) = BYTE
  194.  188  188        0000 0055  |WATCHV1  EQU       $55                 .  Software Watchdog value #1
  195.  189  189        0000 00AA  |WATCHV2  EQU       $AA                 .  Software Watchdog value #2
  196.  190  190        0000 0A44  |CSPAR    EQU       SIM+$44             Chip Select Pin Assignment Register
  197.  191  191        0000 0A48  |CSBARBT  EQU       SIM+$48             Chip Select Base Boot Register
  198.  192  192        0000 0A4A  |CSORBT   EQU       SIM+$4A             Chip Select Option Boot Register
  199.  193  193        0000 0A4C  |CSBAR0   EQU       SIM+$4C             Chip Select 0 Base Register
  200.  194  194        0000 0A4E  |CSOR0    EQU       SIM+$4E             Chip Select 0 Option Register
  201.  195  195        0000 0A50  |CSBAR1   EQU       SIM+$50             Chip Select 1 Base Register
  202.  196  196        0000 0A52  |CSOR1    EQU       SIM+$52             Chip Select 1 Option Register
  203.  197  197        0000 0A54  |CSBAR2   EQU       SIM+$54             Chip Select 2 Base Register
  204.  198  198        0000 0A56  |CSOR2    EQU       SIM+$56             Chip Select 2 Option Register
  205.  199  199                   |
  206.  200  200                   |*
  207.  201  201                   |* Option Register Equates (CSORBT, CSORn):
  208.  202  202                   |*
  209.  203  203        0000 0000  |B2K      EQU       0                   2K    block size
  210.  204  204        0000 0001  |B8K      EQU       1                   8K    block size
  211.  205  205        0000 0002  |B16K     EQU       2                   16K   block size
  212.  206  206        0000 0003  |B64K     EQU       3                   64K   block size
  213.  207  207        0000 0004  |B128K    EQU       4                   128K  block size
  214.  208  208        0000 0005  |B256K    EQU       5                   256K  block size
  215.  209  209        0000 0006  |B512K    EQU       6                   512K  block size
  216.  210  210        0000 0007  |B1M      EQU       7                   1MB   block size
  217.  211  211        0000 0000  |ASYNC    EQU       $0000               Asynchronous mode
  218.  212  212        0000 8000  |SYNC     EQU       $8000               Synchronous  mode
  219.  213  213        0000 4000  |CS_UPPB  EQU       2*$2000             Upper byte
  220.  214  214        0000 2000  |CS_LOWB  EQU       1*$2000             Lower byte
  221.  215  215        0000 6000  |CS_BOTHB EQU       3*$2000             Both  bytes (upper or lower)
  222.  216  216        0000 0800  |CS_R     EQU       1*$800              Read
  223.  217  217        0000 1000  |CS_W     EQU       2*$800              Write
  224.  218  218        0000 1800  |CS_RW    EQU       3*$800              Read or write
  225.  219  219        0000 0000  |CS_AS    EQU       0*$400              Address Strobe (AS*)
  226.  220  220        0000 0400  |CS_DS    EQU       1*$400              Data    Strobe (DS*)
  227.  221  221        0000 000E  |CS_FAST  EQU       14                  Fast     termination DSACK*
  228.  222  222        0000 000F  |CS_EXT   EQU       15                  External termination DSACK*
  229.  223  223        0000 0040  |CS_WAIT  EQU       1*$40               Wait cycles for DSACK*
  230.  224  224        0000 0000  |CS_CSP   EQU       0*$10               CPU  space
  231.  225  225        0000 0010  |CS_USP   EQU       1*$10               User space
  232.  226  226        0000 0020  |CS_SSP   EQU       2*$10               Supervisor space
  233.  227  227        0000 0030  |CS_SUSP  EQU       3*$10               Supervisor/User space
  234.  228  228        0000 0002  |CS_LVL   EQU       1*$2                Interrupt priority level
  235.  229  229        0000 0001  |CS_AVEC  EQU       1                   Autovector enable
  236.  230  230                   |
  237.  231  231                   |
  238.  232  232                   |******************************************************************************
  239.  233  233                   |*
  240.  234  234                   |        SYSTEM
  241.  235    1m       0000 0001  +SECTD    SET       1                   ! DEFINE DATA SECTION
  242.  236    2m       0000 000E  +SECTP    SET       14                  ! DEFINE PROGRAM SECTION
  243.  237    3m  0000            +         SECTION   SECTP               ! PUT USER INTO PROG. SECTION
  244.  238  235                   |
  245.  239  236                   |* Start Chip Select Initialization:
  246.  240  237                   |*
  247.  241  238                   |INIT_CS:
  248.  242  239   0000 46FC 2700  |        MOVE.W    #SR_VAL,SR           Ensure status register initialized.
  249.  243  240   0004 4BF8 F000  |        LEA       HI_BASE,A5           Assume registers are at high memory.
  250.  244  241                   |
  251.  245  242                   |* Set up CSBOOT CHIP SELECT:
  252.  246  243                   |*  - Long word also gets .CSORBT value into CSORBT register!
  253.  247  244                   |*  - Must set up wait cycles for Boot ROM before we change Bus Monitor
  254.  248  245                   |*    timeout value in SYPCR (allows booting in 8-bit mode!).
  255.  249  246                   |*  - SR and CSBOOT/CSORBT initialized by INIT_T1 routine.  See
  256.  250  247                   |*    INITTBL.SA and RESETV.SA files for details.  We repeat the init-
  257.  251  248                   |*    ialization here in case the user has by-passed/disabled calling
  258.  252  249                   |*    the INIT_T1 routine via the PWR_TBL1 Power On Branch vector.
  259.  253  250                   |*
  260.  254  251   0008 2B7B 0170  |        MOVE.L    ((.CSBARBT).L,PC),CSBARBT(A5)
  261.  254        000C FFFF FFF4  |
  262.  254        0010 0A48       |
  263.  255  252                   |
  264.  256  253                   |* Set up SYSTEM PROTECTION REGISTER (SYPCR) per paramter area values:
  265.  257  254                   |*   - controls such things as Software Watchdog, Halt Monitor, Bus Monitor, etc.
  266.  258  255                   |*   - SYPCR is a write-once register!
  267.  259  256   0012 102D 0A20  |        MOVE.B    SYPCR(A5),D0
  268.  260  257   0016 7E00       |        MOVEQ.L   #0,D7                Clear all flag bits.
  269.  261  258   0018 0800 0006  |        BTST      #SWP_BIT,D0          Test SWP bit = MODCK* at Power Up
  270.  262  259                   |   IF  <NE>  THEN.S                    If bit set, then
  271.  263    1s  001C 6604       +        BNE     .1
  272.  264  260   001E 08C7 001F  |        BSET      #EXTAL_BIT,D7        .  Set External Clock flag bit on.
  273.  265  261                   |   ENDI
  274.  266    1s                  +.1:
  275.  267  262   0022 803B 0170  |        OR.B      ((SYPCR_OR).L,PC),D0
  276.  267        0026 FFFF FFDA  |
  277.  268  263   002A C03B 0170  |        AND.B     ((SYPCR_AND).L,PC),D0
  278.  268        002E FFFF FFD2  |
  279.  269  264   0032 1B40 0A20  |        MOVE.B    D0,SYPCR(A5)
  280.  270  265                   |* From now on, the Software Watchdog could be running!  The SWE_BIT in SYPCR_AND
  281.  271  266                   |* controls the Software Watchdog as follows:
  282.  272  267                   |*          0 = Watchdog is disabled
  283.  273  268                   |*          1 = Watchdog is enabled
  284.  274  269                   |* The SWE_BIT in the real SYPCR register can also be tested, but is usually a
  285.  275  270                   |* bit more difficult because the module register block is movable!
  286.  276  271                   |
  287.  277  272                   |* Now let's go to 16.7 MHZ:
  288.  278  273                   |*
  289.  279  274   0036 006D 4000  |        OR.W      #VCO_X,SYNCR(A5)     X-bit doubles the current speed!
  290.  279        003A 0A04       |
  291.  280  275                   |
  292.  281  276                   |* Set up Module Configuration Register (MCR) per paramter area values:
  293.  282  277                   |*   - controls such things as FRZBM, MM, IARB, etc.
  294.  283  278   003C 302D 0A00  |        MOVE.W    MCR(A5),D0
  295.  284  279   0040 807B 0170  |        OR.W      ((MCR_OR).L,PC),D0
  296.  284        0044 FFFF FFBC  |
  297.  285  280   0048 C07B 0170  |        AND.W     ((MCR_AND).L,PC),D0
  298.  285        004C FFFF FFB4  |
  299.  286  281   0050 3B40 0A00  |        MOVE.W    D0,MCR(A5)
  300.  287  282                   |* From now on, the registers could have been relocated to low memory!
  301.  288  283                   |
  302.  289  284   0054 0800 0006  |        BTST      #MM_BIT,D0
  303.  290  285                   |   IF  <EQ>  THEN.S                    If MM bit = 0, then
  304.  291    1s  0058 6706       +        BEQ     .2
  305.  292  286   005A 4BF9 007F  |        LEA       LO_BASE,A5           .  registers are at low memory!
  306.  292        005E F000       |
  307.  293  287                   |   ENDI
  308.  294    1s                  +.2:
  309.  295  288                   |* [A5] = register module base address!
  310.  296  289                   |
  311.  297  290                   |* Service the Software Watchdog (just in case it's running!):
  312.  298  291   0060 1B7C 0055  |        MOVE.B    #WATCHV1,SWSR(A5)
  313.  298        0064 0A27       |
  314.  299  292   0066 1B7C 00AA  |        MOVE.B    #WATCHV2,SWSR(A5)
  315.  299        006A 0A27       |
  316.  300  293                   |
  317.  301  294                   |*
  318.  302  295                   |* Set up all Chip Selects as "chip selects" in case user's have connected h/w
  319.  303  296                   |* devices.  Otherwise, address lines would be toggling as program runs and
  320.  304  297                   |* possibly cause the devices to be enabled!
  321.  305  298   006C 2B7C FFFF  |        MOVE.L    #$FFFFFFFF,CSPAR(A5)  All = chip selects, 16-bit port
  322.  305        0070 FFFF 0A44  |
  323.  306  299                   |*                                       .  (unused bits have no effect!)
  324.  307  300                   |
  325.  308  301                   |* Set up RAM and CSBOOT CHIP SELECTs to old BCC values:
  326.  309  302                   |*
  327.  310  303   0074 2B7B 0170  |        MOVE.L    ((.CSBAR0).L,PC),CSBAR0(A5)
  328.  310        0078 FFFF FF88  |
  329.  310        007C 0A4C       |
  330.  311  304   007E 2B7B 0170  |        MOVE.L    ((.CSBAR1).L,PC),CSBAR1(A5)
  331.  311        0082 FFFF FF7E  |
  332.  311        0086 0A50       |
  333.  312  305                   |
  334.  313  306                   |* Test for old BBC by enabling its onboard RAM and ROM.
  335.  314  307                   |* If RAM found, then
  336.  315  308                   |*   assume old BCC with old Platform Board
  337.  316  309                   |* else
  338.  317  310                   |*   assume new BCC with new Platform Board
  339.  318  311                   |* endif
  340.  319  312                   |* If board == old_BCC
  341.  320  313                   |*   initialize chip selects for old BCC and old platform board
  342.  321  314                   |* else
  343.  322  315                   |*   initialize chip selects for new BCC and new platform board
  344.  323  316                   |* endif
  345.  324  317                   |*
  346.  325  318                   |* To find RAM:
  347.  326  319                   |*   ($0000) = $5AA5A55A
  348.  327  320                   |*   delay to allow bus capacitance to dissipate
  349.  328  321                   |*   if ($0000) == $5AA5A55A then
  350.  329  322                   |*     ($0000) = $A55A5AA5
  351.  330  323                   |*     delay to allow bus capacitance to dissipate
  352.  331  324                   |*     if ($0000) == $A55A5AA5 then
  353.  332  325                   |*       RAM found
  354.  333  326                   |*     endif
  355.  334  327                   |*   else
  356.  335  328                   |*      ($2F00) = $5AA5A55A
  357.  336  329                   |*      delay to allow bus capacitance to dissipate
  358.  337  330                   |*      if ($2F00) == $5AA5A55A then
  359.  338  331                   |*        ($2F00) = $A55A5AA5
  360.  339  332                   |*        delay to allow bus capacitance to dissipate
  361.  340  333                   |*        if ($2F00) == $A55A5AA5 then
  362.  341  334                   |*          RAM found
  363.  342  335                   |*        endif
  364.  343  336                   |*     endif
  365.  344  337                   |*  endif
  366.  345  338                   |*
  367.  346  339                   |
  368.  347  340                   |* NOTE:  By default at Power Up, CSBOOT responds to any address in the
  369.  348  341                   |*        range of $0-$FFFFF (block size= 1 MB) to select the Boot ROM.
  370.  349  342                   |*        Since the Boot ROM only uses address lines A0-A16 (128K), it
  371.  350  343                   |*        appears replicated thru the memory map at every even ROM size
  372.  351  344                   |*        ($20000) boundary as follows:
  373.  352  345                   |*           $00000, $20000, $40000, $60000, $80000, $A0000, $C0000, $E0000
  374.  353  346                   |*        Thus the power up reset vectors for the SP and PC are fetched from
  375.  354  347                   |*        locations $0-7 and the PC is set to the memory range where we will
  376.  355  348                   |*        be programming the Boot ROM to appear at via the chip selects.
  377.  356  349                   |*        When the programming occurs, there are no addressing "glitches"
  378.  357  350                   |*        because we stay at the same locations!
  379.  358  351                   |
  380.  359  352   0088 7001       |        MOVEQ.L   #NEW_BCC,D0
  381.  360  353   008A 223C 5AA5  |        MOVE.L    #$5AA5A55A,D1        NOTE:  D1 and D2 are inverse patterns!
  382.  360        008E A55A       |
  383.  361  354   0090 243C A55A  |        MOVE.L    #$A55A5AA5,D2
  384.  361        0094 5AA5       |
  385.  362  355   0096 91C8       |        SUB.L     A0,A0                Test loca. = $0000.
  386.  363  356                   |
  387.  364  357   0098 2081       |        MOVE.L    D1,(A0)
  388.  365  358                   |        T_DELAY
  389.  366    1m  009A 4E71       +        NOP
  390.  367    2m  009C 4E71       +        NOP
  391.  368    3m  009E 4E71       +        NOP
  392.  369  359                   |   IF.L  D1 <EQ> (A0)  THEN.S          If test loca. is good, then
  393.  370    1s  00A0 B290       +        CMP.L   (A0),D1
  394.  371    2s  00A2 6610       +        BNE     .3
  395.  372  360   00A4 2082       |        MOVE.L    D2,(A0)
  396.  373  361                   |        T_DELAY
  397.  374    1m  00A6 4E71       +        NOP
  398.  375    2m  00A8 4E71       +        NOP
  399.  376    3m  00AA 4E71       +        NOP
  400.  377  362                   |      IF.L  D2 <EQ> (A0)  THEN.S       .  If inverse is good, then
  401.  378    1s  00AC B490       +        CMP.L   (A0),D2
  402.  379    2s  00AE 6602       +        BNE     .4
  403.  380  363   00B0 7000       |        MOVEQ.L   #OLD_BCC,D0          .    Got RAM, so must be old BCC!
  404.  381  364                   |      ENDI
  405.  382    1s                  +.4:
  406.  383  365                   |   ELSE.S                              else maybe just 1 bad loca.
  407.  384    1s  00B2 601E       +        BRA     .5
  408.  385    2s                  +.3:
  409.  386  366   00B4 307C 2F00  |        MOVE.W    #$2F00,A0            .  Test loca. = $2F00.
  410.  387  367                   |*------------------------------------------------------------------------------
  411.  388  368                   |* CAUTION:  In the above "MOVE.W #$XXXX,A0" do not use an address with the
  412.  389  369                   |*           sign bit set, e.g., $8000, because sign extension will cause a
  413.  390  370                   |*           BUS ERROR below and crash the system!  Also, the address must
  414.  391  371                   |*           not be in the user ram area ($3000-FFFF), or we could corrupt
  415.  392  372                   |*           the user's ram!  Thus we use $2F00, which is inside CPU32Bug's
  416.  393  373                   |*           internal stack area.
  417.  394  374                   |*------------------------------------------------------------------------------
  418.  395  375   00B8 2081       |        MOVE.L    D1,(A0)
  419.  396  376                   |        T_DELAY
  420.  397    1m  00BA 4E71       +        NOP
  421.  398    2m  00BC 4E71       +        NOP
  422.  399    3m  00BE 4E71       +        NOP
  423.  400  377                   |      IF.L  D1 <EQ> (A0)  THEN.S       .  If test loca. is good, then
  424.  401    1s  00C0 B290       +        CMP.L   (A0),D1
  425.  402    2s  00C2 660E       +        BNE     .6
  426.  403  378   00C4 2082       |        MOVE.L    D2,(A0)
  427.  404  379                   |        T_DELAY
  428.  405    1m  00C6 4E71       +        NOP
  429.  406    2m  00C8 4E71       +        NOP
  430.  407    3m  00CA 4E71       +        NOP
  431.  408  380                   |         IF.L  D2 <EQ> (A0)  THEN.S    .    If inverse is good, then
  432.  409    1s  00CC B490       +        CMP.L   (A0),D2
  433.  410    2s  00CE 6602       +        BNE     .7
  434.  411  381   00D0 7000       |            MOVEQ.L   #OLD_BCC,D0      .      Got RAM, so must be old BCC.
  435.  412  382                   |         ENDI
  436.  413    1s                  +.7:
  437.  414  383                   |      ENDI
  438.  415    1s                  +.6:
  439.  416  384                   |   ENDI
  440.  417    1s                  +.5:
  441.  418  385                   |
  442.  419  386                   |* Service the Software Watchdog (just in case it's running!):
  443.  420  387   00D2 1B7C 0055  |        MOVE.B    #WATCHV1,SWSR(A5)
  444.  420        00D6 0A27       |
  445.  421  388   00D8 1B7C 00AA  |        MOVE.B    #WATCHV2,SWSR(A5)
  446.  421        00DC 0A27       |
  447.  422  389                   |
  448.  423  390   00DE 0C00 0000  |        CMP.B     #OLD_BCC,D0
  449.  424  391   00E2 6610       |        BNE.S     BCC_NEW                 Branch if old BCC not found!
  450.  425  392                   |
  451.  426  393                   |* Here for old BCC and old Platform board (see Rev. 1 schematics for each):
  452.  427  394                   |*
  453.  428  395                   |*  U1/U3 = 120 nsec RAM w/fast termination
  454.  429  396                   |*  U2/U4 = ROM, but laid out wrong, so can only be used as 120 nsec RAM!
  455.  430  397                   |*
  456.  431  398                   |*   CSBOOT = BCC U4       332Bug EPROM
  457.  432  399                   |*   CS0    = BCC U3       read/write enable for MSB=UPPER=EVEN ram
  458.  433  400                   |*   CS1    = BCC U2       read/write enable for LSB=LOWER=ODD  ram
  459.  434  401                   |*   CS2    = PFB U1/U3    read       enable for MSB/LSB=BOTH   rams
  460.  435  402                   |*   CS3    = PFB U1       write      enable for LSB=LOWER=ODD  ram
  461.  436  403                   |*   CS4    = PFB U4       read       enable for MSB=UPPER=EVEN ram/eprom
  462.  437  404                   |*   CS5    = PFB U2       read       enable for LSB=LOWER=ODD  ram/eprom
  463.  438  405                   |*   CS6    = PFB U5       chip       enable for MC68881/882
  464.  439  406                   |*   CS7    = <unused>
  465.  440  407                   |*   CS8    = PFB          ABORT pushbutton autovector
  466.  441  408                   |*   CS9    = <unused>
  467.  442  409                   |*   CS10   = PFB U3       write enable for MSB=UPPER=EVEN ram
  468.  443  410                   |*                         . cut/jump U3-27 from CS4 to CS10 required!
  469.  444  411                   |*
  470.  445  412                   |* Set up other CHIP SELECT ports (CS0,CS1,CSBOOT already done):
  471.  446  413                   |*
  472.  447  414   00E4 41FB 0170  |BCC_OLD LEA       ((.CSBAR2).L,PC),A0  Point to old CS2 entry.
  473.  447        00E8 FFFF FF18  |
  474.  448  415   00EC 43ED 0A54  |        LEA       CSBAR2(A5),A1        Point to corresponding SIM reg.
  475.  449  416   00F0 7008       |        MOVEQ.L   #(10-2+1)-1,D0       Set count to do CS2-CS10.
  476.  450  417                   |*                                      .  ("-1" for DBRA loop below!)
  477.  451  418   00F2 600E       |        BRA.S     CS_COM               Go to common init routine!
  478.  452  419                   |
  479.  453  420                   |
  480.  454  421                   |* Here for new BCC and new Platform board (see Rev. 2 schematics for each):
  481.  455  422                   |*
  482.  456  423                   |*  U1/U3 = 120 nsec RAM w/fast termination
  483.  457  424                   |*  U2/U4 = 250 nsec ROM (or jumper selectable as RAM)
  484.  458  425                   |*
  485.  459  426                   |*   CSBOOT = BCC U4       CPU32Bug EPROM
  486.  460  427                   |*   CS0    = BCC U3       write enable for MSB=UPPER=EVEN ram
  487.  461  428                   |*   CS1    = BCC U2       write enable for LSB=LOWER=ODD  ram
  488.  462  429                   |*   CS2    = BCC U3/U2    read  enable for MSB/LSB=BOTH   rams
  489.  463  430                   |*   CS3    = <unused>
  490.  464  431                   |*   CS4    = PFB          ABORT pushbutton autovector
  491.  465  432                   |*   CS5    = PFB U5       chip  enable for MC68881/882
  492.  466  433                   |*                         . cut/jump U5-J3 from CS2 to CS5 required!
  493.  467  434                   |*   CS6    = PFB U2       read  enable for LSB=LOWER=ODD  ram/eprom
  494.  468  435                   |*   CS7    = PFB U4       read  enable for MSB=UPPER=EVEN ram/eprom
  495.  469  436                   |*   CS8    = PFB U1/U3    read  enable for MSB/LSB=BOTH   rams
  496.  470  437                   |*   CS9    = PFB U1       write enable for LSB=LOWER=ODD  ram
  497.  471  438                   |*   CS10   = PFB U3       write enable for MSB=UPPER=EVEN ram
  498.  472  439                   |*
  499.  473  440                   |* Set up all CHIP SELECT ports (CSBOOT already done):
  500.  474  441                   |*
  501.  475  442   00F4 41FB 0170  |BCC_NEW LEA       ((CSBAR0$).L,PC),A0  Point to new CS0 entry.
  502.  475        00F8 FFFF FF08  |
  503.  476  443   00FC 43ED 0A4C  |        LEA       CSBAR0(A5),A1        Point to corresponding SIM reg.
  504.  477  444   0100 700A       |        MOVEQ.L   #(10-0+1)-1,D0       Set count to do CS0-CS10.
  505.  478  445                   |*                                      .  ("-1" for DBRA loop below!)
  506.  479  446                   |
  507.  480  447                   |* Common CHIP SELECTS initialization routine:
  508.  481  448                   |*   A0.L = chip select configuration table entry (base addr)
  509.  482  449                   |*   A1.L = corresponding SIM register
  510.  483  450                   |*   D0.W = number of chip selects -1 to be initialized
  511.  484  451                   |*
  512.  485  452   0102 22D8       |CS_COM  MOVE.L    (A0)+,(A1)+          Init. SIM base addr + option register.
  513.  486  453   0104 51C8 FFFC  |        DBRA      D0,CS_COM            Continue until all regs init'ed.
  514.  487  454                   |
  515.  488  455                   |* Service the Software Watchdog (just in case it's running!):
  516.  489  456   0108 1B7C 0055  |        MOVE.B    #WATCHV1,SWSR(A5)
  517.  489        010C 0A27       |
  518.  490  457   010E 1B7C 00AA  |        MOVE.B    #WATCHV2,SWSR(A5)
  519.  490        0112 0A27       |
  520.  491  458                   |
  521.  492  459                   |* [D7.L] = Power Up Status Flag
  522.  493  460   0114 60FF FFFF  |        BRA.L     PWR_TBL2             Return to Power On Branch Vector
  523.  493        0118 FEEA       |
  524.  494  461                   |        END
  525.  494 lines assembled
  526.  
  527. symbol table:
  528. symbol name       attrib.  section    value
  529. -----------       -------  -------    -----
  530. INIT_CS           .data    14         0x0
  531.      @241 @62
  532. PWR_TBL2          xref                 
  533.      493 @65
  534. .CSBAR0           xref                 
  535.      310 @66
  536. .CSBAR1           xref                 
  537.      311 @66
  538. .CSBAR2           xref                 
  539.      447 @66
  540. .CSBARBT          xref                 
  541.      254 @66
  542. CSBAR0$           xref                 
  543.      475 @67
  544. MCR_OR            xref                 
  545.      284 @68
  546. MCR_AND           xref                 
  547.      285 @68
  548. SYPCR_OR          xref                 
  549.      267 @69
  550. SYPCR_AND         xref                 
  551.      268 @69
  552. SYSTEM            macro                
  553.      234
  554. T_DELAY           macro                
  555.      404 396 373 365
  556. OLD_BCC           abs.                0x0
  557.      423 411 380 @92
  558. NEW_BCC           abs.                0x1
  559.      359 @93
  560. SR_VAL            abs.                0x2700
  561.      242 @101
  562. RAM_BASE          abs.                0x0
  563.      161 123 @103
  564. RAM_SIZE          abs.                0x10000
  565.      125 @104
  566. ROM1_BASE         abs.                0xe0000
  567.      162 138 130 @105
  568. ROM1_SIZE         abs.                0x20000
  569.      138 @106
  570. IRAM_BASE         abs.                0x40000
  571.      166 @107
  572. FPCP_BASE         abs.                0xffffe800
  573.      165 @108
  574. FCRYSTVAL         abs.                0x8000
  575.      @110
  576. HI_BASE           abs.                0xfffff000
  577.      243 @111
  578. LO_BASE           abs.                0x7ff000
  579.      292 @113
  580. SIM               abs.                0xa00
  581.      198 197 196 195 194 193 192 191 190 187
  582.      176 174 172 @114
  583. RAMCR             abs.                0xb00
  584.      @115
  585. QSM               abs.                0xc00
  586.      @116
  587. AUTO_BASE         abs.                0xfffff800
  588.      167 @117
  589. EXTAL_BIT         abs.                0x1f
  590.      264 @120
  591. CHKSUM_BIT        abs.                0x1e
  592.      @121
  593. LOCALRAM          abs.                0x0
  594.      137 128 126 @123
  595. SYSRAMSZ          abs.                0x4000
  596.      127 126 @124
  597. LCLRAMMX          abs.                0x10000
  598.      137 127 @125
  599. USRRAM            abs.                0x4000
  600.      @126
  601. USRRAMSZ          abs.                0xc000
  602.      @127
  603. RAMSTART          abs.                0x0
  604.      @128
  605. LOCALROM          abs.                0xe0000
  606.      @130
  607. LCLROMSZ          abs.                0x10000
  608.      @131
  609. ROMUNPGM          abs.                0xff
  610.      133 @132
  611. FILL.1            abs.                0xff
  612.      134 134 @133
  613. FILL.2            abs.                0xffff
  614.      135 135 @134
  615. FILL.4            abs.                0xffffffff
  616.      @135
  617. RAM2_BASE         abs.                0x10000
  618.      163 @137
  619. ROM2_BASE         abs.                0x100000
  620.      164 @138
  621. VECTSIZ           abs.                0x400
  622.      143 @140
  623. USERLEN           abs.                0x1000
  624.      143 @141
  625. MEMINC            abs.                0x4000
  626.      143 @142
  627. STKLEN            abs.                0x2bfc
  628.      @143
  629. ABORTLVL          abs.                0x7
  630.      @148
  631. ABORTVEC          abs.                0x1f
  632.      @149
  633. ACFAILVL          abs.                0x7
  634.      @150
  635. ACFAILVC          abs.                0x41
  636.      @151
  637. TIMERLVL          abs.                0x6
  638.      @152
  639. TIMERVEC          abs.                0x42
  640.      @153
  641. ADDRMASK          abs.                0xfff800
  642.      167 166 165 164 163 162 161 @160
  643. RAM               abs.                0x0
  644.      @161
  645. ROM               abs.                0xe0000
  646.      @162
  647. RAM2              abs.                0x10000
  648.      @163
  649. ROM2              abs.                0x100000
  650.      @164
  651. FPCP              abs.                0xffe800
  652.      @165
  653. IRAM              abs.                0x40000
  654.      @166
  655. AVEC_7            abs.                0xfff800
  656.      @167
  657. CSBAR_XX          abs.                0x0
  658.      @169
  659. CSOR_XX           abs.                0x0
  660.      @170
  661. MCR               abs.                0xa00
  662.      286 283 @172
  663. MM_BIT            abs.                0x6
  664.      289 @173
  665. SYNCR             abs.                0xa04
  666.      279 @174
  667. VCO_X             abs.                0x4000
  668.      279 @175
  669. SYPCR             abs.                0xa20
  670.      269 259 @176
  671. SWE_BIT           abs.                0x7
  672.      @177
  673. SWP_BIT           abs.                0x6
  674.      261 @178
  675. SWE               abs.                0x80
  676.      @179
  677. SWP               abs.                0x40
  678.      @180
  679. HME               abs.                0x8
  680.      @181
  681. BME               abs.                0x4
  682.      @182
  683. BMT8              abs.                0x3
  684.      @183
  685. BMT16             abs.                0x2
  686.      @184
  687. BMT32             abs.                0x1
  688.      @185
  689. BMT64             abs.                0x0
  690.      @186
  691. SWSR              abs.                0xa27
  692.      490 489 421 420 299 298 @187
  693. WATCHV1           abs.                0x55
  694.      489 420 298 @188
  695. WATCHV2           abs.                0xaa
  696.      490 421 299 @189
  697. CSPAR             abs.                0xa44
  698.      305 @190
  699. CSBARBT           abs.                0xa48
  700.      254 @191
  701. CSORBT            abs.                0xa4a
  702.      @192
  703. CSBAR0            abs.                0xa4c
  704.      476 310 @193
  705. CSOR0             abs.                0xa4e
  706.      @194
  707. CSBAR1            abs.                0xa50
  708.      311 @195
  709. CSOR1             abs.                0xa52
  710.      @196
  711. CSBAR2            abs.                0xa54
  712.      448 @197
  713. CSOR2             abs.                0xa56
  714.      @198
  715. B2K               abs.                0x0
  716.      @203
  717. B8K               abs.                0x1
  718.      @204
  719. B16K              abs.                0x2
  720.      @205
  721. B64K              abs.                0x3
  722.      @206
  723. B128K             abs.                0x4
  724.      @207
  725. B256K             abs.                0x5
  726.      @208
  727. B512K             abs.                0x6
  728.      @209
  729. B1M               abs.                0x7
  730.      @210
  731. ASYNC             abs.                0x0
  732.      @211
  733. SYNC              abs.                0x8000
  734.      @212
  735. CS_UPPB           abs.                0x4000
  736.      @213
  737. CS_LOWB           abs.                0x2000
  738.      @214
  739. CS_BOTHB          abs.                0x6000
  740.      @215
  741. CS_R              abs.                0x800
  742.      @216
  743. CS_W              abs.                0x1000
  744.      @217
  745. CS_RW             abs.                0x1800
  746.      @218
  747. CS_AS             abs.                0x0
  748.      @219
  749. CS_DS             abs.                0x400
  750.      @220
  751. CS_FAST           abs.                0xe
  752.      @221
  753. CS_EXT            abs.                0xf
  754.      @222
  755. CS_WAIT           abs.                0x40
  756.      @223
  757. CS_CSP            abs.                0x0
  758.      @224
  759. CS_USP            abs.                0x10
  760.      @225
  761. CS_SSP            abs.                0x20
  762.      @226
  763. CS_SUSP           abs.                0x30
  764.      @227
  765. CS_LVL            abs.                0x2
  766.      @228
  767. CS_AVEC           abs.                0x1
  768.      @229
  769. SECTD             abs.                0x1
  770.      @235
  771. SECTP             abs.                0xe
  772.      237 @236
  773. .1                .data    14         0x22
  774.      @266 263
  775. .2                .data    14         0x60
  776.      @294 291
  777. .3                .data    14         0xb4
  778.      @385 371
  779. .4                .data    14         0xb2
  780.      @382 379
  781. .5                .data    14         0xd2
  782.      @417 384
  783. .6                .data    14         0xd2
  784.      @415 402
  785. .7                .data    14         0xd2
  786.      @413 410
  787. BCC_NEW           .data    14         0xf4
  788.      @475 424
  789. BCC_OLD           .data    14         0xe4
  790.      @447
  791. CS_COM            .data    14         0x102
  792.      486 @485 451
  793. .data             section  14         0x0
  794. 132 symbols
  795.